package com.example.mapper;

//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.Dormitory;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
public interface DormitoryMapper {
        @Select("SELECT * FROM dormitory")
        List<Dormitory> finAll();

    @Insert("INSERT INTO dormitory (floor_num,layer,room_num,bed_total, bed_surplus,price)VALUES(#{floor_num},#{layer},#{room_num},#{bed_total},"+
            "#{ bed_surplus},#{price})")
    int insert(Dormitory student);
    @Select("SELECT * FROM dormitory where floor_num=#{floor_num} and layer=#{layer} and room_num=#{room_num}")
    List<Dormitory> findAllByfloor(String floor_num, Integer layer, Integer room_num);

    int update(Dormitory student);

    @Delete("delete from dormitory where floor_num=#{floor_num} and layer=#{layer} and room_num=#{room_num}")
    Integer deleteBy(@Param("floor_num") String floor_num,Integer layer,Integer room_num );

    List<Dormitory> selectPage(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize, @Param("floor_num") String floo_num,@Param("layer") Integer layer, @Param("room_num") Integer room_num);

    Integer selectTotal(@Param("floor_num") String floor_num, @Param("layer") Integer layer, @Param("room_num") Integer room_num);
}
